package com.wc.alorithm_blue_bridge._简单题.等差素数列;

/**
 * @Author congege
 * @Description 等差素数列
 * https://www.lanqiao.cn/problems/646/learning/?page=1&first_category_id=1&sort=students_count
 * @Date Created in 2023/9/20-8:44
 * 偷鸡原话：长度为K的等差素数数列，他的公差可以被任意一个小于k的素数整除
 */
public class Main {
    public static void main(String[] args) {
        System.out.println(2*3*5*7);
        Main main = new Main();
        System.out.println(main.isPrime(187));
    }

    /**
     * 判断是否为素数
     *
     * @param number
     * @return True 是素数，反之
     */
    public boolean isPrime(int number) {
        if (number <= 1) {
            return false;
        }

        int mid = (int) Math.pow(number, 0.5);
        for (int i = 2; i <= mid; i++) {
            if (number % i == 0) {
//                System.out.println(i);
                return false;
            }
        }
        return true;
    }
}
